HAL RAMECC initialization and configuration functions migration ¶
The goal of this page is to show how to migrate the initialization sequence using STM32CubeMX2:
Open STM32CubeMX2 RAMECC configuration panel.
Configure the SW layer HAL.
Configure the RAMECC main features.
Configure the advanced RAMECC features.
Configure the NVIC if the application requires the RAMECC to be used in IT mode.
Generate the code.
HAL RAMECC configuration panel ¶
Create a new project with the STM32CubeMX2, then start the initialization and the main configuration.
HAL RAMECC advanced features configuration ¶
Configure the advanced RAMECC features if needed.
NVIC configuration ¶
Configure the NVIC in case of an interrupt.
Generated RAMECC initialization and de-initialization sequences ¶
The RAMECC initialization and de-initialization sequences are generated in the
mx_ramecc_hal_init
function in
mx_ramecc.c
file under
$YOUR_PROJECT_NAME$/$YOUR_PROJECT_NAME$_SW/generated/STM32Cube_CodeGen.
Related concepts:
|
Topic |
HAL1 code snippet |
HAL2 code snippet |
|---|---|---|
|
Initialization and configuration sequence |
static void MX_RAMECC_Init(void)
{
hramecc1_m2.Instance = RAMECC1_Monitor2;
if (HAL_RAMECC_Init(&hramecc1_m2) != HAL_OK)
{
Error_Handler();
}
}
static void MX_NVIC_Init(void)
{
HAL_NVIC_SetPriority(ECC_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(ECC_IRQn);
}
|
hal_ramecc_controller_t mx_ramecc1_init(void)
{
HAL_RAMECC_EnableMonitor(HAL_RAMECC_ITCM);
HAL_CORTEX_NVIC_SetPriority(RAMECC_IRQn, HAL_CORTEX_NVIC_PREEMP_PRIORITY_0, HAL_CORTEX_NVIC_SUB_PRIORITY_0);
HAL_CORTEX_NVIC_EnableIRQ(RAMECC_IRQn);
return HAL_RAMECC1;
}
|
|
Deinitialization sequence |
static void MX_RAMECC_DeInit(void)
{
if (HAL_RAMECC_DeInit(&hramecc1_m2) != HAL_OK)
{
Error_Handler();
}
}
static void MX_NVIC_Deinit(void)
{
HAL_NVIC_DisableIRQ(RAMECC_IRQn);
}
|
void mx_ramecc1_deinit(void)
{
HAL_RAMECC_DisableMonitor(HAL_RAMECC_ITCM);
HAL_CORTEX_NVIC_DisableIRQ(RAMECC_IRQn);
}
|
|
IRQ handle function |
void RAMECC_IRQHandler(void)
{
HAL_RAMECC_IRQHandler(&hramecc1_m2);
}
|
void RAMECC_IRQHandler(void)
{
HAL_RAMECC_IRQHandler(HAL_RAMECC_ITCM);
}
|